/**
 * File: 
 * Proj/Lab:
 * Author:
 * Date:
 * Section:
 * Email:
 */
package proj;

import java.util.ArrayList;

/**
 * @author Ben
 *
 */
public class Semester {

	private int season;
	private int year;
	private boolean isPrevious;
	private ArrayList<CourseRecord> courseRecords = new ArrayList<CourseRecord>();
	
	public Semester(Semester clonee)
	{
		season = clonee.getSeason();
		year = clonee.getYear();
		isPrevious = clonee.isPrevious();
		courseRecords = clonee.getCourseRecords();
	}
	
	public Semester(int mySeason, int myYear, boolean previous)
	{
		season = mySeason;
		year = myYear;
		isPrevious = previous;
	}
	
	public Semester(int mySeason, int myYear, boolean previous, ArrayList<CourseRecord> courses)
	{
		season = mySeason;
		year = myYear;
		isPrevious = previous;
		courseRecords = courses;
	}
	
	public int getSeason() 
	{
		return season;
	}

	public void setSeason(int mySeason) 
	{
		this.season = mySeason;
	}

	public int getYear() 
	{
		return year;
	}

	public void setYear(int myYear) 
	{
		this.year = myYear;
	}

	public boolean isPrevious() 
	{
		return isPrevious;
	}

	public void setPrevious(boolean previous) 
	{
		this.isPrevious = previous;
	}

	public ArrayList<CourseRecord> getCourseRecords() 
	{
		ArrayList<CourseRecord> newCourseRecords = new ArrayList<CourseRecord>();
		for(int i = 0; i != courseRecords.size(); i++)
		{
			newCourseRecords.add(new CourseRecord(courseRecords.get(i)));
		}
		
		return newCourseRecords;
	}
	
	public void setCourseRecords(ArrayList<CourseRecord> myCourseRecords) 
	{
		this.courseRecords = myCourseRecords;
	}

	public boolean removeCourseRecord(String courseCode)
	{
		for(int i = 0; i != courseRecords.size(); i++)
		{
			if(courseRecords.get(i).getCourseID() == courseCode)
			{
				courseRecords.remove(i);
				return true;
			}	
		}	
		return false;
	}
	
	public void addCourseRecord(CourseRecord newCourseRecord)
	{
		courseRecords.add(newCourseRecord);
	}
	
}
